const gulp = require('gulp');
const webpack = require('webpack-stream');
const pug = require('gulp-pug');
const paths = {
  entry: ['origin/entry/*.js', './dist/public/build'],
  pug: ['views/*.pug', './dist'],
  src: ['origin/src/**/*.*', 'dist/public']
};
gulp.task('webpack', () => {
  return gulp.src(paths.entry[0])
    .pipe(webpack(require('./webpack.config.js')))
    .pipe(gulp.dest(paths.entry[1]));
});
gulp.task('pug', () => {
  return gulp.src(paths.pug[0])
    .pipe(pug({pretty: true}))
    .pipe(gulp.dest(paths.pug[1]));
});
gulp.task('src', () => {
  return gulp.src(paths.src[0])
    .pipe(gulp.dest(paths.src[1]));
});
gulp.task('watch', () => {
  gulp.watch('origin/**/*.js', ['webpack']);
  gulp.watch('origin/**/*.scss', ['webpack']);
  gulp.watch('views/**/*.pug', ['pug']);
});
gulp.task('default', ['watch']);
